//
//  NetWorkTool.swift
//  麦兜直播
//
//  Created by yeqingyu on 16/10/15.
//  Copyright © 2016年 yeqingyu. All rights reserved.
//


enum requestType {
    case get
    case post
}

import UIKit
import Alamofire

class NetWorkTool {

    
    class func requestNetData(urlString:String,method:requestType,parameters:[String:Any]?=nil, responseCallBack:@escaping(_ result:Any)->()){
        let type = (method == .get) ? HTTPMethod.get : HTTPMethod.post

        Alamofire.request(urlString, method: type, parameters: parameters).responseJSON { (response) in
            
            guard let result = response.result.value else{
                print(response.result.error)
                return
            }
            
            responseCallBack(result)
        }
        
    }
    
}
